]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
shellDBus: Add ScreenTransition()
authorAlexander Mikhaylenko <alexm@gnome.org>
Thu, 23 Sep 2021 07:45:14 +0000 (12:45 +0500)
committerAlexander Mikhaylenko <alexm@gnome.org>
Fri, 11 Feb 2022 21:54:57 +0000 (02:54 +0500)
Settings will use this when switching between light and dark styles.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2070>

data/dbus-interfaces/org.gnome.Shell.xml
js/ui/background.js
js/ui/layout.js
js/ui/shellDBus.js

index 38154cbdb97b82e66e8f438e5363c60a8c52e1b1..3ffb5c3742cfe13cdd5906c89a81fd5ef2434831 100644 (file)
@@ -35,6 +35,7 @@
       <arg type="au" direction="in" name="action"/>
       <arg type="b" direction="out" name="success"/>
     </method>
+    <method name="ScreenTransition"/>
     <signal name="AcceleratorActivated">
       <arg name="action" type="u"/>
       <arg name="parameters" type="a{sv}"/>
index b4a599da8a8da86bef9a01641916d3a49e802361..9c6a1636d23c0edada21e6d487d24a5a26288a66 100644 (file)
@@ -733,6 +733,11 @@ var BackgroundManager = class BackgroundManager {
         this._newBackgroundActor = null;
         this.emit('changed');
 
+        if (Main.layoutManager.screenTransition.visible) {
+            oldBackgroundActor.destroy();
+            return;
+        }
+
         oldBackgroundActor.ease({
             opacity: 0,
             duration: FADE_ANIMATION_TIME,
index 102bed041ef6d2ccb72486c60719ddff344a2ff0..68941049d231e8354f41a10d3679c2578c8c436f 100644 (file)
@@ -18,6 +18,9 @@ var BACKGROUND_FADE_ANIMATION_TIME = 1000;
 var HOT_CORNER_PRESSURE_THRESHOLD = 100; // pixels
 var HOT_CORNER_PRESSURE_TIMEOUT = 1000; // ms
 
+const SCREEN_TRANSITION_DELAY = 250; // ms
+const SCREEN_TRANSITION_DURATION = 500; // ms
+
 function isPopupMetaWindow(actor) {
     switch (actor.meta_window.get_window_type()) {
     case Meta.WindowType.DROPDOWN_MENU:
@@ -298,6 +301,13 @@ var LayoutManager = GObject.registerClass({
         monitorManager.connect('monitors-changed',
                                this._monitorsChanged.bind(this));
         this._monitorsChanged();
+
+        this.screenTransition = new ScreenTransition();
+        this.uiGroup.add_child(this.screenTransition);
+        this.screenTransition.add_constraint(new Clutter.BindConstraint({
+            source: this.uiGroup,
+            coordinate: Clutter.BindCoordinate.ALL,
+        }));
     }
 
     // This is called by Main after everything else is constructed
@@ -309,6 +319,7 @@ var LayoutManager = GObject.registerClass({
 
     showOverview() {
         this.overviewGroup.show();
+        this.screenTransition.hide();
 
         this._inOverview = true;
         this._updateVisibility();
@@ -316,6 +327,7 @@ var LayoutManager = GObject.registerClass({
 
     hideOverview() {
         this.overviewGroup.hide();
+        this.screenTransition.hide();
 
         this._inOverview = false;
         this._updateVisibility();
@@ -1369,3 +1381,42 @@ var PressureBarrier = class PressureBarrier {
     }
 };
 Signals.addSignalMethods(PressureBarrier.prototype);
+
+var ScreenTransition = GObject.registerClass(
+class ScreenTransition extends Clutter.Actor {
+    _init() {
+        super._init({ visible: false });
+    }
+
+    vfunc_hide() {
+        this.content = null;
+        super.vfunc_hide();
+    }
+
+    run() {
+        if (this.visible)
+            return;
+
+        Main.uiGroup.set_child_above_sibling(this, null);
+
+        const rect = new imports.gi.cairo.RectangleInt({
+            x: 0,
+            y: 0,
+            width: global.screen_width,
+            height: global.screen_height,
+        });
+        const [, , , scale] = global.stage.get_capture_final_size(rect);
+        this.content = global.stage.paint_to_content(rect, scale, Clutter.PaintFlag.NO_CURSORS);
+
+        this.opacity = 255;
+        this.show();
+
+        this.ease({
+            opacity: 0,
+            duration: SCREEN_TRANSITION_DURATION,
+            delay: SCREEN_TRANSITION_DELAY,
+            mode: Clutter.AnimationMode.EASE_OUT_QUAD,
+            onStopped: () => this.hide(),
+        });
+    }
+});
index e44875a5201f5cdd3479974c8151c9f602464aea..9f1e75d02bbbce439a4f297c14432327c0435d00 100644 (file)
@@ -251,6 +251,19 @@ var GnomeShell = class {
         invocation.return_value(GLib.Variant.new('(b)', [ungrabSucceeded]));
     }
 
+    ScreenTransitionAsync(params, invocation) {
+        try {
+            this._senderChecker.checkInvocation(invocation);
+        } catch (e) {
+            invocation.return_gerror(e);
+            return;
+        }
+
+        Main.layoutManager.screenTransition.run();
+
+        invocation.return_value(null);
+    }
+
     _emitAcceleratorActivated(action, device, timestamp) {
         let destination = this._grabbedAccelerators.get(action);
         if (!destination)